﻿using System;

namespace 常用控件作业
{
    public partial class 有手就彳亍 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DropDownList1.Items.Add("江西");
                DropDownList1.Items.Add("福建");
                DropDownList1.Items.Add("湖南");
                DropDownList2.Items.Add("抚州");
                DropDownList2.Items.Add("南昌");
                DropDownList2.Items.Add("景德镇");
               

            }
        }



        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string province = DropDownList1.SelectedValue;
            DropDownList2.Items.Clear();
            if (province == "江西")
            {
                DropDownList2.Items.Add("抚州");
                DropDownList2.Items.Add("南昌");
                DropDownList2.Items.Add("景德镇");

            }
            else if (province == "福建")
            {
                DropDownList2.Items.Add("福州");
                DropDownList2.Items.Add("厦门");
                DropDownList2.Items.Add("漳州");
            }
            else if (province == "湖南")
            {
                DropDownList2.Items.Add("株洲");
                DropDownList2.Items.Add("长沙");
                DropDownList2.Items.Add("湘潭");
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Literal1.Text = "用户名:"+TextBox1.Text;
            Literal2.Text = "密码:"+TextBox2.Text;
            if (DropDownList3.SelectedValue == "man")
            {
                Literal3.Text = "性别:男";
            }
            else { Literal3.Text = "性别:女"; }
            Literal4.Text = "爱好："+ CheckBoxList1.SelectedValue +" " +CheckBoxList2.SelectedValue + " " + CheckBoxList3.SelectedValue + " " + CheckBoxList4.SelectedValue;
            Literal5.Text ="籍贯："+ DropDownList1.Text+"省 " + DropDownList2.Text+"市";
            Literal6.Text = "其他信息：" + TextBox6.Text;
            string fileName = FileUpload1.FileName;
            Literal6.Text = "头像：";
            if (fileName.EndsWith(".jpg")|| fileName.EndsWith(".png") || fileName.EndsWith(".jpeg"))
            {
                Console.WriteLine("头像：");
                string url = Server.MapPath("/img/" + fileName);
                FileUpload1.SaveAs(url);
                Image1.ImageUrl = "/img/" + fileName;
                Image1.Visible = true;

            }
        }

        protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
    }
}